package SyntheticData;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Locale;

import Analysis.CorrelationManagerClass;
import Analysis.MetaCorrelationsManagersListClass;
import ClassificationAlgorithm.ContentOnlyClass;
import ClassificationAlgorithm.ICAClass;
import ClassificationAlgorithm.LinkOnlyClass;
import ContentToLink.ContentToLinkConverterClass;
import Definitions.GraphClass;
import Global.ConstantVariable;
import Global.ConstantVariable.DefaultFileNamesConstants;
import Global.DirectoryStructureAndSettingsClass;
import Global.GlobalClass;
import LatexForCorrelations.LatexUtilityForSyntheticMetaCorrelationsResults;
import LatexForResults.LatexUtilityForSyntheticDatasetsResultsClass;
import Matlab.MatlabRelatedWorksClass;
import MetaClassifierAlgorithms.MetaClassifierManagerClass;
import Read.ReadTest;
import Result.MetaResultListsClass;
import Result.ResultClassListClass;
import Statistics.statisticsManagerClass;
import Utility.FileUtilityClass;


public class syntheticDataGeneratorClass {
	
	int numberOfInitialNodes;
	int numberOfFinalNodes;
	
	int numberOfLabels;
	
	int numberOfContentBits;
	int numberOfLinkBits;    
    static int numberOfSharedBits;
    
    int thresholdLevel;
    
    double reassignProb;			//Not used for determinstic model.
    double biasedProbability;    
    
    static int datasetNoWithTheseParameters;
    
    public static BufferedWriter outForSyntehicDataDescriptorFile;
    public static BufferedWriter outForSyntehicDataResultsSummaryFile;
    public static BufferedWriter outForSyntehicDataFoldsResultsFile;
    
    public static BufferedWriter outForSyntehicDataMetaResultsSummaryFile;
    public static BufferedWriter outForSyntheticDataExtendedResultsFile;
    
    public static BufferedWriter outForSyntheticMetaCorrelationsCOResultsFile;
    public static BufferedWriter outForSyntheticMetaCorrelationsLOResultsFile;
    
    public static TogetherFilesHolderClass outForMatlabCodeAverageDegreeVsSimilarityResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeLinearDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeSemiLogYDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeLogLogDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeCCVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeHomophilyVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeHomophilyVsDDDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    
    public static TogetherFilesHolderClass outForMatlabCodeLAVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeAccuracyVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeAccuracyVsDDDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    
    
    public static TogetherFilesHolderClass outForMatlabCodeHomophilyVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeHomophilyVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;    
    public static TogetherFilesHolderClass outForMatlabCodeLAVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeLAVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;    
    public static TogetherFilesHolderClass outForMatlabCodeLAVsHomophilyResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeLAVsHomophilyDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;    
    public static TogetherFilesHolderClass outForMatlabCodeAccVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeAccVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeAccVsHomophilyResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeAccVsHomophilyDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    
    public static TogetherFilesHolderClass outForMatlabCodeAccVsLAResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    public static TogetherFilesHolderClass outForMatlabCodeAccVsLADotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
    
    
    
    
    ResultClassListClass resultsForCO;
    ResultClassListClass resultsForLO;
    ResultClassListClass resultsForICA;
    
    ResultClassListClass resultsForAVE;
    ResultClassListClass resultsForMAX;
    ResultClassListClass resultsForPROD;
    ResultClassListClass resultsForLA;
    ResultClassListClass resultsForDFMM;
    ResultClassListClass resultsForLB;
    
    ResultClassListClass resultsForLAMAX;
    ResultClassListClass resultsForLBMAX;
    
    static MetaResultListsClass metaResultsForTheDatasetsGeneratedWithTheSameParameters;
    static MetaCorrelationsManagersListClass metaCorrelationsManagersList;
        
	
	public syntheticDataGeneratorClass(int datasetNoWithTheseParameters, int numberOfInitialNodes, int numberOfFinalNodes, int numberOfLabels, int numberOfContentBits, int numberOfLinkBits, int numberOfSharedBits, int thresholdLevel, double reassignProb, double biasedProbability)
	{
		this.numberOfInitialNodes = numberOfInitialNodes;
		this.numberOfFinalNodes = numberOfFinalNodes;
		
		this.numberOfLabels = numberOfLabels;
		
		this.numberOfContentBits = numberOfContentBits;
		this.numberOfLinkBits = numberOfLinkBits;
		this.numberOfSharedBits = numberOfSharedBits;
		
		this.thresholdLevel = thresholdLevel;
		
		this.reassignProb = reassignProb;
		this.biasedProbability = biasedProbability;		
		
		this.datasetNoWithTheseParameters = datasetNoWithTheseParameters;
	}
	

	public int getDatasetNoWithTheseParameters()
	{
		return datasetNoWithTheseParameters;
	}	
	
	public int getNumberOfInitialNodes()
	{
		return numberOfInitialNodes;
	}
	
	public int getNumberOfFinalNodes()
	{
		return numberOfFinalNodes;
	}
	
	public int getNumberOfLabels()
	{
		return numberOfLabels;
	}

	public int getNumberOfContentBits()
	{
		return numberOfContentBits;
	}
	
	public int getNumberOfLinkBits()
	{
		return numberOfLinkBits;
	}
	
	public static int getNumberOfSharedBits()
	{
		return numberOfSharedBits;
	}
	//TODO AS Hidden bit sayisi donulecek.
	public int getNumberOfHiddenBits()
	{
		return 0;
	}
	
	public int getThresholdLevel()
	{
		return thresholdLevel;
	}
	
	public double getReassignProb()
	{
		return reassignProb;
	}
	
	public double getBiasedProbility()
	{
		return biasedProbability;
	}
	
	public ResultClassListClass  getResultsForCO()
	{
		return resultsForCO;
	}
	
	public ResultClassListClass  getResultsForLO()
	{
		return resultsForLO;
	}

	public ResultClassListClass  getResultsForICA()
	{
		return resultsForICA;
	}
	
	public ResultClassListClass  getResultsForAVE()
	{
		return resultsForAVE;
	}
	
	public ResultClassListClass  getResultsForMAX()
	{
		return resultsForMAX;
	}
	
	public ResultClassListClass  getResultsForPROD()
	{
		return resultsForPROD;
	}
	
	public ResultClassListClass  getResultsForLA()
	{
		return resultsForLA;
	}
	
	public ResultClassListClass  getResultsForLB()
	{
		return resultsForLB;
	}
	
	public ResultClassListClass  getResultsForDFMM()
	{
		return resultsForDFMM;
	}
	
	public ResultClassListClass  getResultsForLAMAX()
	{
		return resultsForLAMAX;
	}
	
	public ResultClassListClass  getResultsForLBMAX()
	{
		return resultsForLBMAX;
	}
	
	public static MetaResultListsClass getMetaResultsList()
	{
		return metaResultsForTheDatasetsGeneratedWithTheSameParameters;
	}	
	
	String generateStyntheticDataset(int dataGenerationMethodType)
	{
		
		try {
			
			double similarityThreshold = thresholdLevel*(1.0/numberOfLinkBits);
			
			int numberOfBits = numberOfContentBits + numberOfLinkBits - numberOfSharedBits;
			
	        String name = String.format(Locale.US,
	                "det_%d_%d_%02d_%02d_%02d_%d_%d_%d_%1.0f",
	                numberOfLabels, numberOfBits, numberOfLinkBits,
	                numberOfContentBits, numberOfSharedBits,
	                numberOfInitialNodes, numberOfFinalNodes,
	                thresholdLevel, reassignProb);
	        
	        String syntehicDataSettingFolder=ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY 
	        								+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.DATASETS_MAIN_DIRECTORY
	        								+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderDatasetsDirectory.SYNTHETIC_DATA_ROOT_FOLDER_NAME;
	        
	        String fullPathForStaticGeneratedSyntheticDataFiles=ConstantVariable.DefaultDirectoryNamesConstants.ROOT_STATIC_DIRECTORY 
											+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderStaticRootDirectory.DATASETS_MAIN_DIRECTORY
											+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderDatasetsDirectory.SYNTHETIC_DATA_ROOT_FOLDER_NAME;
	        
	        String strDirectory="NShr-"+numberOfSharedBits+ConstantVariable.Format_ConstantVariables.DASH_CHAR+"Thr-"+similarityThreshold+ConstantVariable.Format_ConstantVariables.DASH_CHAR+datasetNoWithTheseParameters+"/";
	        
	        System.out.println("syntehicDataSettingFolder:"+syntehicDataSettingFolder);
	        System.out.println("strDirectory:"+strDirectory);
	        
	        String fullPathForGeneratedSyntheticDataFiles = syntehicDataSettingFolder + strDirectory;
	        fullPathForStaticGeneratedSyntheticDataFiles = fullPathForStaticGeneratedSyntheticDataFiles + strDirectory;
	        
	        DirectoryStructureAndSettingsClass.createDirectory(fullPathForGeneratedSyntheticDataFiles);

	        DirectoryStructureAndSettingsClass.createDirectory(fullPathForStaticGeneratedSyntheticDataFiles);

	    	DirectoryStructureAndSettingsClass.setRootDirectoryNameForTheCurrentDataset(strDirectory);
	    	DirectoryStructureAndSettingsClass.setStaticRootDirectoryNameForTheCurrentDataset(strDirectory);
	    	DirectoryStructureAndSettingsClass.setcontentFileName(0, name);
	    	DirectoryStructureAndSettingsClass.setLinkFileName(0, name);
	    	
	    	System.out.println("fullPathForGeneratedSyntheticDataFiles:"+fullPathForGeneratedSyntheticDataFiles);    	        
	        DirectoryStructureAndSettingsClass.createSubDirectoriesForADataset(fullPathForGeneratedSyntheticDataFiles);
	        DirectoryStructureAndSettingsClass.createSubDirectoriesForAStaticDataset(fullPathForStaticGeneratedSyntheticDataFiles);
	        
	        fullPathForStaticGeneratedSyntheticDataFiles += ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderStaticDatasetDirectory.RAW_DATA_FOLDER_NAME;

	        
	        switch(dataGenerationMethodType)
			{
				//TODO AS STOCHASITIC
				case ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationMethod_Constants.STOCHASTIC_SINGLE_METHOD:
				{
					//name += ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGeneratedFilesPrefixes_Constants.STOCHASTIC_FILE_PREFIX;										
					//stochasticSingle(numberOfLabels, numberOfContentBits+numberOfLinkBits-numberOfSharedBits, numberOfLinkBits, numberOfContentBits,numberOfSharedBits,numberOfInitialNodes,numberOfInitialNodes,similarityThreshold, reassignProb, biasedProbability);
					break;
				}		
				case ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationMethod_Constants.DETERMINISTIC_SINGLE_METHOD:
				{
					
					//name += ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGeneratedFilesPrefixes_Constants.DETERMINISTIC_FILE_PREFIX;
					
					deterministicSingle(fullPathForStaticGeneratedSyntheticDataFiles, name);
					break;
				}
				case ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationMethod_Constants.FIXED_CONNECTIONS_SINGLE_METHOD:
				{
					//name += ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGeneratedFilesPrefixes_Constants.FIXED_CONNECTIONS_FILE_PREFIX;					
					fixedConnectionsSingle(fullPathForStaticGeneratedSyntheticDataFiles, name);
					break;
				}			
			}
	        return name;
		
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
				
		
	}
    public static void stochasticSingle() throws IOException {
        int numLabels = 2;
        int numElements = 20;
        int numNetworkElements = 15;
        int numContentElements = 15;
        int numSharedElements = 10;
        int numInitialVertices = 10;
        int numFinalVertices = 1000;
        double indepConnectProb = 0.15;
        double reassignProb = 0.5;   
        
        
        String name = String.format(Locale.US,
                "sto-%d-%d-%02d-%02d-%02d-%d-%d-%4.2f-%4.2f",
                numLabels, numElements, numNetworkElements,
                numContentElements, numSharedElements,
                numInitialVertices, numFinalVertices,
                indepConnectProb, reassignProb);

        StochasticBuilder builder = new StochasticBuilder(numLabels,
                numElements, numNetworkElements,
                numContentElements, numSharedElements);
        
        builder.build(numInitialVertices, indepConnectProb, 1.0);
        builder.grow(numFinalVertices - numInitialVertices, indepConnectProb,
                reassignProb);

        System.out.println("stochasticSingle # of vertices: " + builder.getGraph().numVertices());
        System.out.println("stochasticSingle # of arcs:     " + builder.getGraph().numArcs());
        GraphWriting.writeFeatures(builder.getGraph(), name + ".features.out");
        GraphWriting.writeIndicesContentsAndLabels(builder.getGraph(),
                numNetworkElements, numContentElements, numSharedElements,
                name + ".contents.out");
        GraphWriting.writeArcs(builder.getGraph(), name + ".arcs.out");
    }

    public void deterministicSingle(String fullPathForFiles, String fileName) throws IOException {
        int numLabels = numberOfLabels;
        int numElements = numberOfContentBits + numberOfLinkBits - numberOfSharedBits;
        int numNetworkElements = numberOfLinkBits;
        int numContentElements = numberOfContentBits;
        int numSharedElements = numberOfSharedBits;
        int numInitialVertices = numberOfInitialNodes;
        int numFinalVertices = numberOfFinalNodes;
        double similarityThreshold = thresholdLevel*(1.0/numberOfLinkBits);
        //double reassignProb = reassignProb;
        double biasedProb = biasedProbability;
        
        String name = fullPathForFiles + fileName;

        DeterministicBuilder builder = new DeterministicBuilder(numLabels,
                numElements, numNetworkElements,
                numContentElements, numSharedElements);
        
        builder.build(numInitialVertices, similarityThreshold, biasedProb);
        builder.grow(numFinalVertices - numInitialVertices, similarityThreshold,
                reassignProb);
        
        System.out.println("deterministicSingle # of vertices: " + builder.getGraph().numVertices());
        System.out.println("deterministicSingle # of arcs:     " + builder.getGraph().numArcs());
        GraphWriting.writeFeatures(builder.getGraph(), name + ".features.out");        
        GraphWriting.writeIndicesContentsAndLabels(builder.getGraph(),
                numNetworkElements, numContentElements, numSharedElements,
                name + ".contents.out");
        GraphWriting.writeArcs(builder.getGraph(), name + ".arcs.out");
    }

    public void fixedConnectionsSingle(String fullPathForFiles, String fileName) throws IOException {
        int numLabels = numberOfLabels;
        int numElements = numberOfContentBits + numberOfLinkBits - numberOfSharedBits;
        int numNetworkElements = numberOfLinkBits;
        int numContentElements = numberOfContentBits;
        int numSharedElements = numberOfSharedBits;
        int numInitialVertices = numberOfInitialNodes;
        int numFinalVertices = numberOfFinalNodes;
        double similarityThreshold = thresholdLevel*(1.0/numberOfLinkBits);
        //double reassignProb = reassignProb;
        double biasedProb = biasedProbability;
        
        String name = fullPathForFiles + fileName;

        FixedConnectionsBuilder builder = new FixedConnectionsBuilder(numLabels,
                numElements, numNetworkElements,
                numContentElements, numSharedElements);

        builder.build(numInitialVertices, 5, 0.5);
        builder.grow(numFinalVertices - numInitialVertices, 10,
                reassignProb);

        System.out.println("fixedConnectionsSingle # of vertices: " + builder.getGraph().numVertices());
        System.out.println("fixedConnectionsSingle # of arcs:     " + builder.getGraph().numArcs());
        GraphWriting.writeFeatures(builder.getGraph(), name + ".features.out");
        GraphWriting.writeIndicesContentsAndLabels(builder.getGraph(),
                numNetworkElements, numContentElements, numSharedElements,
                name + ".contents.out");
        GraphWriting.writeArcs(builder.getGraph(), name + ".arcs.out");
    }

    public static void stochasticHighMedLow() throws IOException {
            int numLabels = 2;
            int numElements = 20;
            int numNetworkElementsList[] = {15, 10, 5};
            int numContentElementsList[] = {15, 10, 5};
            int numSharedElementsList[] = {15, 10, 5, 0};
            int numInitialVertices = 10;
            int numFinalVertices = 1000;
            double indepConnectProb = 1.0;
            double reassignProb = 0.5;
            for (int numNetworkElements : numNetworkElementsList) {
                for (int numContentElements : numContentElementsList) {
                    for (int numSharedElements : numSharedElementsList) {
                        // Ensure that parameter set is valid.
                        if (numSharedElements <= numNetworkElements &&
                                numSharedElements <= numContentElements &&
                                numNetworkElements + numContentElements - numSharedElements <= numElements) {
                            switch (numNetworkElements) {
                                case 5:
                                    indepConnectProb = 0.15;
                                    reassignProb = 0.5;
                                    break;
                                case 10:
                                    indepConnectProb = 1.0;
                                    reassignProb = 0.3;
                                    break;
                                case 15:
                                    indepConnectProb = 1.0;
                                    reassignProb = 0.2;
                                    break;
                            }
                            
                            String name = String.format(Locale.US,
                                    "highmedlow\\sto-%d-%d-%02d-%02d-%02d-%d-%d-%4.2f-%4.2f",
                                    numLabels, numElements, numNetworkElements,
                                    numContentElements, numSharedElements,
                                    numInitialVertices, numFinalVertices,
                                    indepConnectProb, reassignProb);

                            System.out.println("Working on " + name + "...");
                            StochasticBuilder builder = new StochasticBuilder(numLabels,
                                    numElements, numNetworkElements,
                                    numContentElements, numSharedElements);
                            builder.build(numInitialVertices, indepConnectProb, 1.0);
                            builder.grow(numFinalVertices - numInitialVertices,
                                    indepConnectProb, reassignProb);

                            System.out.println("stochasticHighMedLow # of vertices: " + builder.getGraph().numVertices());
                            System.out.println("stochasticHighMedLow # of arcs:     " + builder.getGraph().numArcs());
                            GraphWriting.writeFeatures(builder.getGraph(), name + ".features.out");
                            GraphWriting.writeLabelsAndContents(builder.getGraph(),
                                    numNetworkElements, numContentElements, numSharedElements,
                                    name + ".contents.out");
                            GraphWriting.writeArcs(builder.getGraph(), name + ".arcs.out");
                        }
                    }
                }
            }
    }
    
    public static int getGraphOrderForTogetherGraphicResults(boolean isFirstCall, boolean isForContent)
    {
    	if(isForContent && ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Variables.MAX_NUMBER_OF_SYNTHETIC_DATASETS_TO_BE_GENERATED_WITH_THE_SAME_PARAMETERS==1)
    		return ConstantVariable.Matlab_ConstantVariables.GraphOrderType.FIRST_AND_LAST_GRAPH;
    	
    	if(datasetNoWithTheseParameters == ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Variables.MAX_NUMBER_OF_SYNTHETIC_DATASETS_TO_BE_GENERATED_WITH_THE_SAME_PARAMETERS-1 && (isForContent || (isForContent==false && isFirstCall==false)))
    		return ConstantVariable.Matlab_ConstantVariables.GraphOrderType.LAST_GRAPH;
    	else if(datasetNoWithTheseParameters == 0 && isFirstCall)
    		return ConstantVariable.Matlab_ConstantVariables.GraphOrderType.FIRST_GRAPH;
    	else 
    		return ConstantVariable.Matlab_ConstantVariables.GraphOrderType.MIDDLE_GRAPH;
    }
    
    public static BufferedWriter createSyntehicDataDescriptorFile()
    {
    	String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_DEFINITIONS_DIRECTORY;
    	
    	try {
    		
    		File descFile=DirectoryStructureAndSettingsClass.createFile(path, ConstantVariable.DefaultFileNamesConstants.SYN_DESC_FILENAME);
    		FileWriter fstream;
    		fstream = new FileWriter(descFile);
    		BufferedWriter out = new BufferedWriter(fstream);
    		return out;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
    }
    
    public static BufferedWriter createSyntehicDataSummaryResultsFile()
    {
    	String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_RESULTS_DIRECTORY;
    	
    	try {
    		
    		File descFile=DirectoryStructureAndSettingsClass.createFile(path, ConstantVariable.DefaultFileNamesConstants.SYN_RSLT_FILENAME);
    		FileWriter fstream;
    		fstream = new FileWriter(descFile);
    		BufferedWriter out = new BufferedWriter(fstream);
    		return out;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
    }
    
    public static BufferedWriter createSyntehicDataFoldsResultsFile()
    {
    	String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_RESULTS_DIRECTORY;
    	
    	try {
    		
    		File descFile=DirectoryStructureAndSettingsClass.createFile(path, ConstantVariable.DefaultFileNamesConstants.SYN_FOLDS_RSLT_FILENAME);
    		FileWriter fstream;
    		fstream = new FileWriter(descFile);
    		BufferedWriter out = new BufferedWriter(fstream);
    		return out;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
    }
    
    public static BufferedWriter createSyntehicDataSummaryMetaResultsFile()
    {
    	String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_RESULTS_DIRECTORY;
    	
    	try {
    		
    		File descFile=DirectoryStructureAndSettingsClass.createFile(path, ConstantVariable.DefaultFileNamesConstants.SYN_META_RSLT_FILENAME);
    		FileWriter fstream;
    		fstream = new FileWriter(descFile);
    		BufferedWriter out = new BufferedWriter(fstream);
    		return out;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
    }
    
    public static BufferedWriter createSyntheticDataExtendedResultsFile()
    {
    	String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_RESULTS_DIRECTORY;
    	
    	try {
    		
    		File descFile=DirectoryStructureAndSettingsClass.createFile(path, ConstantVariable.DefaultFileNamesConstants.SYN_EXTENDED_RESULTS_FILENAME);
    		FileWriter fstream;
    		fstream = new FileWriter(descFile);
    		BufferedWriter out = new BufferedWriter(fstream);
    		return out;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
    }
    
    public static BufferedWriter createSyntehicDataMetaCorrelationsCOResultsFile()
    {
    	String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_RESULTS_DIRECTORY;
    	
    	try {
    		
    		File descFile=DirectoryStructureAndSettingsClass.createFile(path, ConstantVariable.DefaultFileNamesConstants.SYN_META_CORRELATIONS_CO_RSLT_FILENAME);
    		FileWriter fstream;
    		fstream = new FileWriter(descFile);
    		BufferedWriter out = new BufferedWriter(fstream);
    		return out;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
    }
    
    public static BufferedWriter createSyntehicDataMetaCorrelationsLOResultsFile()
    {
    	String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
    				+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_RESULTS_DIRECTORY;
    	
    	try {
    		
    		File descFile=DirectoryStructureAndSettingsClass.createFile(path, ConstantVariable.DefaultFileNamesConstants.SYN_META_CORRELATIONS_LO_RSLT_FILENAME);
    		FileWriter fstream;
    		fstream = new FileWriter(descFile);
    		BufferedWriter out = new BufferedWriter(fstream);
    		return out;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
    }
    
    
    
    public static TogetherFilesHolderClass getOutForMatlabCodeAverageDegreeVsSimilarityPDFResultsTogetherFile()
	{
		return outForMatlabCodeAverageDegreeVsSimilarityResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}
    
    public static TogetherFilesHolderClass getOutForMatlabCodeLinearDDPDFResultsTogetherFile()
	{
		return outForMatlabCodeLinearDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}

    public static TogetherFilesHolderClass getOutForMatlabCodeSemiLogYDDPDFResultsTogetherFile()
	{
		return outForMatlabCodeSemiLogYDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}
    
    public static TogetherFilesHolderClass getOutForMatlabCodeLogLogDDPDFResultsTogetherFile()
	{
		return outForMatlabCodeLogLogDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}    
    
    public static TogetherFilesHolderClass getOutForMatlabCodeCCVsDDPDFResultsTogetherFile()
	{
		return outForMatlabCodeCCVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}
    
    public static TogetherFilesHolderClass getOutForMatlabCodeHomophilyVsDDPDFResultsTogetherFile()
	{
		return outForMatlabCodeHomophilyVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}
    
    public static TogetherFilesHolderClass getOutForMatlabCodeHomophilyVsDDDotPDFResultsTogetherFile()
	{
		return outForMatlabCodeHomophilyVsDDDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}
    
    public static TogetherFilesHolderClass getOutForMatlabCodeLAVsDDPDFResultsTogetherFile()
	{
		return outForMatlabCodeLAVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeAccuracyVsDDPDFResultsTogetherFile()
	{
		return outForMatlabCodeAccuracyVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeAccuracyVsDDDotPDFResultsTogetherFile()
	{
		return outForMatlabCodeAccuracyVsDDDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;		
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeHomophilyVsCCPDFResultsTogetherFile()
	{
		return outForMatlabCodeHomophilyVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeHomophilyVsCCDotPDFResultsTogetherFile()
	{
		return outForMatlabCodeHomophilyVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeLAVsCCPDFResultsTogetherFile()
	{
		return outForMatlabCodeLAVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeLAVsCCPDotDFResultsTogetherFile()
	{
		return outForMatlabCodeLAVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
		
	public static TogetherFilesHolderClass getOutForMatlabCodeLAVsHomophilyPDFResultsTogetherFile()
	{
		return outForMatlabCodeLAVsHomophilyResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeLAVsHomophilyDotPDFResultsTogetherFile()
	{
		return outForMatlabCodeLAVsHomophilyDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeAccVsCCPDFResultsTogetherFile()
	{
		return outForMatlabCodeAccVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeAccVsCCDotPDFResultsTogetherFile()
	{
		return outForMatlabCodeAccVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeAccVsHomophilyPDFResultsTogetherFile()
	{
		return outForMatlabCodeAccVsHomophilyResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeAccVsHomophilyDotPDFResultsTogetherFile()
	{
		return outForMatlabCodeAccVsHomophilyDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}

	public static TogetherFilesHolderClass getOutForMatlabCodeAccVsLAPDFResultsTogetherFile()
	{
		return outForMatlabCodeAccVsLAResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
	
	public static TogetherFilesHolderClass getOutForMatlabCodeAccVsLADotPDFResultsTogetherFile()
	{
		return outForMatlabCodeAccVsLADotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile;
	}
		
    static void sytheticDataGenerationStartEvent()
    {    	         
         outForSyntehicDataDescriptorFile = createSyntehicDataDescriptorFile();
         LatexUtilityForSyntheticDatasetsResultsClass.synDescriptorTableCreatorClass.printLatexSynDescriptorTableHeaderFirstPartToTheFile(outForSyntehicDataDescriptorFile);         
               
         outForSyntehicDataResultsSummaryFile = createSyntehicDataSummaryResultsFile();
         LatexUtilityForSyntheticDatasetsResultsClass.synDataSummaryResultsTableCreatorClass.printLatexSynSummaryResultsTableHeaderFirstPartToTheFile(outForSyntehicDataResultsSummaryFile);
         
         outForSyntehicDataFoldsResultsFile = createSyntehicDataFoldsResultsFile();
         LatexUtilityForSyntheticDatasetsResultsClass.synDataFoldsResultsTableCreatorClass.printLatexSynFoldsResultsTableHeaderFirstPartToTheFile(outForSyntehicDataFoldsResultsFile);
         
         outForSyntehicDataMetaResultsSummaryFile = createSyntehicDataSummaryMetaResultsFile();
         LatexUtilityForSyntheticDatasetsResultsClass.synDataSummaryMetaResultsTableCreatorClass.printLatexSynMetaResultsTableHeaderFirstPartToTheFile(outForSyntehicDataMetaResultsSummaryFile);
        
         outForSyntheticDataExtendedResultsFile = createSyntheticDataExtendedResultsFile();
         LatexUtilityForSyntheticDatasetsResultsClass.SyntheticDatasetExtendedResultsTableCreatorClass.printLatexSyntheticDatasetExtendedResultsTableHeaderFirstPartToTheFile(outForSyntheticDataExtendedResultsFile);
         
         outForSyntheticMetaCorrelationsCOResultsFile = createSyntehicDataMetaCorrelationsCOResultsFile();
         //LatexUtilityForSyntheticMetaCorrelationsResults.syntheticMetaCorrelationsTableCreatorClass.printLatexSynMetaCorrelationsForCOTableHeaderFirstPartToTheFile(outForSyntheticMetaCorrelationsCOResultsFile);
         
         outForSyntheticMetaCorrelationsLOResultsFile = createSyntehicDataMetaCorrelationsLOResultsFile();
         //LatexUtilityForSyntheticMetaCorrelationsResults.syntheticMetaCorrelationsTableCreatorClass.printLatexSynMetaCorrelationsForLOTableHeaderFirstPartToTheFile(outForSyntheticMetaCorrelationsLOResultsFile);
    }
    
    static void evaluationOfOneSyntheticDataSetIsCompletedEvent(syntheticDataGeneratorClass currentSyntheticData, GraphClass graph, String datasetName, ArrayList<ResultClassListClass> resultsList)
    {    	         
    	CorrelationManagerClass correlationManager = CorrelationManagerClass.createCorrelationsResults(graph, datasetName);
    	metaCorrelationsManagersList.add(correlationManager);
    	
    	LatexUtilityForSyntheticDatasetsResultsClass.synDescriptorTableCreatorClass.addRecordToTheSynDescTableForTheNewSyntheticDataset(currentSyntheticData);
    	LatexUtilityForSyntheticDatasetsResultsClass.synDataSummaryResultsTableCreatorClass.addRecordToTheSynSummaryResultsTableForTheNewSyntheticDataset(currentSyntheticData);	
    	LatexUtilityForSyntheticDatasetsResultsClass.synDataFoldsResultsTableCreatorClass.addRecordToTheSynFoldsResultsTableForTheNewSyntheticDataset(currentSyntheticData);
    	LatexUtilityForSyntheticDatasetsResultsClass.SyntheticDatasetExtendedResultsTableCreatorClass.addRecordToTheSyntheticDatasetExtendedResultsTable(outForSyntheticDataExtendedResultsFile, resultsList, graph, correlationManager.correlations);
    	LatexUtilityForSyntheticDatasetsResultsClass.increaseSyntheticDatasetIndex();
    	
    	if(currentSyntheticData.resultsForCO!=null)
    		currentSyntheticData.resultsForCO.clear();
    	if(currentSyntheticData.resultsForLO!=null)
    		currentSyntheticData.resultsForLO.clear();
    	if(currentSyntheticData.resultsForICA!=null)
    		currentSyntheticData.resultsForICA.clear();
    	
    	if(currentSyntheticData.resultsForAVE!=null)
    		currentSyntheticData.resultsForAVE.clear();
    	if(currentSyntheticData.resultsForMAX!=null)
    		currentSyntheticData.resultsForMAX.clear();
    	if(currentSyntheticData.resultsForPROD!=null)
    		currentSyntheticData.resultsForPROD.clear();
    	if(currentSyntheticData.resultsForLA!=null)
    		currentSyntheticData.resultsForLA.clear(); 
    	if(currentSyntheticData.resultsForDFMM!=null)
    		currentSyntheticData.resultsForDFMM.clear();
    	if(currentSyntheticData.resultsForLB!=null)
    		currentSyntheticData.resultsForLB.clear();
    	if(currentSyntheticData.resultsForLAMAX!=null)
    		currentSyntheticData.resultsForLAMAX.clear();
    	if(currentSyntheticData.resultsForLBMAX!=null)
    		currentSyntheticData.resultsForLBMAX.clear();
    	
    }
    
    static void sytheticDataGenerationEndEvent()
    {  
    	try {
    		LatexUtilityForSyntheticDatasetsResultsClass.synDescriptorTableCreatorClass.printLatexSynDescTableHeaderEndPartToTheFile(outForSyntehicDataDescriptorFile);
    		LatexUtilityForSyntheticDatasetsResultsClass.synDataSummaryResultsTableCreatorClass.printLatexSynResultsTableHeaderEndPartToTheFile(outForSyntehicDataResultsSummaryFile);
    		LatexUtilityForSyntheticDatasetsResultsClass.synDataFoldsResultsTableCreatorClass.printLatexSynFoldsResultsTableHeaderEndPartToTheFile(outForSyntehicDataFoldsResultsFile);
    		LatexUtilityForSyntheticDatasetsResultsClass.synDataSummaryMetaResultsTableCreatorClass.printLatexSynMetaResultsTableHeaderEndPartToTheFile(outForSyntehicDataMetaResultsSummaryFile);
    		LatexUtilityForSyntheticDatasetsResultsClass.SyntheticDatasetExtendedResultsTableCreatorClass.printLatexSyntheticDatasetExtendedResultsTableHeaderEndPartToTheFile(outForSyntheticDataExtendedResultsFile);

    		outForSyntheticMetaCorrelationsCOResultsFile.close();
			outForSyntheticMetaCorrelationsLOResultsFile.close();
			
			createMatlabFiguresForSyntheticTogetherFiles();
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}   
    }
    
    static void createMatlabFiguresForSyntheticTogetherFiles()
    {
    	try {
    		
    		String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
    		+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
    		+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_RESULTS_DIRECTORY
    		+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderSynteticDatasetsResultsDirectory.SYNTETIC_DATASETS_GRAPHS_TOGETHER_DIRECTORY;


    		String pathForTheMatlabFile = path+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderGenericGraphPropertyDirectory.MATLAB_CODE_FOLDER_NAME;
    		String pathForTheFigureFolder= path+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderGenericGraphPropertyDirectory.MATLAB_FIGURE_DATA_FOLDER_NAME;

    		String[] fileNames = FileUtilityClass.getFileNamesUnderTheGivenDirectory(pathForTheMatlabFile);

    		String matlabFileName;
    		BufferedWriter outForTexFileForTheFigure;

    		for(int i=0; i<fileNames.length; i++)
    		{	
    			if(fileNames[i].substring(fileNames[i].length()-2, fileNames[i].length())== ".m");
    			{
    				matlabFileName = fileNames[i].substring(0, fileNames[i].length()-2);
    				MatlabRelatedWorksClass.executeMatlabWithFileForVIM(pathForTheMatlabFile, pathForTheFigureFolder, matlabFileName);
    				outForTexFileForTheFigure = createTexFileForTheGeneratedTogetherMatlabFigures(pathForTheFigureFolder, matlabFileName);
    				prepareTexFileForTheCreatedMatlabFigure(outForTexFileForTheFigure, pathForTheFigureFolder, matlabFileName, matlabFileName+" for Synthetic Datasets(ms="+syntheticDataGeneratorClass.getNumberOfSharedBits()+")");

    				outForTexFileForTheFigure.close();
    				
    				Utility.FileUtilityClass.copyFile(pathForTheFigureFolder+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderMatlabFigure.LATEX_FILES_OF_THE_FIGURES+matlabFileName+"Figure.tex", ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY+
    						ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY +
    						ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.GENERAL_RESULTS_DIRECTORY+
    						ConstantVariable.DefaultFileNamesConstants.DefaultAllInOneResultsFiles.TOGETHER_RELATED_MATLAB_FIGURES_TEX_COMBO_IN_ONE_FILENAME, false, true);

    			}
    		}
    	} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
    }
    
	public static BufferedWriter createTexFileForTheGeneratedTogetherMatlabFigures(String fullPathOfTheFigureFolder, String fileName)
	{   
		String path = fullPathOfTheFigureFolder
			+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderMatlabFigure.LATEX_FILES_OF_THE_FIGURES;
		
		fileName += "Figure.tex";
		
		try {

			File descFile=DirectoryStructureAndSettingsClass.createFile(path, fileName);
			FileWriter fstream;
			fstream = new FileWriter(descFile);
			BufferedWriter out = new BufferedWriter(fstream);
			return out;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;   
	}
    
    public static void prepareTexFileForTheCreatedMatlabFigure(BufferedWriter outForTexForMatlabFigureFile, String fullPathOfTheFigureFolder, String matlabFileName, String title)
	{
		try {
			outForTexForMatlabFigureFile.write("\\clearpage");
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			outForTexForMatlabFigureFile.write("\\begin{figure}[ht]");
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			outForTexForMatlabFigureFile.write("\\centering");
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			outForTexForMatlabFigureFile.write("\\begin{center}");
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			outForTexForMatlabFigureFile.write("\\vskip 0.25cm");
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			
			String caption = "\\caption{"+title.replace('_','-')+"}";			
			outForTexForMatlabFigureFile.write(caption);
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			
			String figureLabel = "\\label{fig:" + matlabFileName +"}";
			outForTexForMatlabFigureFile.write(figureLabel);
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			
			String graphicsPath = "\\graphicspath{{"+(new File(fullPathOfTheFigureFolder).getAbsolutePath()+"/").replace('\\', '/')+"}}";				
			outForTexForMatlabFigureFile.write(graphicsPath);
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			
			String includeGraphics = "\\includegraphics[scale=0.75]{"+matlabFileName+ConstantVariable.Matlab_ConstantVariables.SUFFIX_OF_THE_MATLAB_FIGURE+"}";				
			outForTexForMatlabFigureFile.write(includeGraphics);
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			
			outForTexForMatlabFigureFile.write("\\end{center}");
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
			outForTexForMatlabFigureFile.write("\\end{figure}");
			outForTexForMatlabFigureFile.write(ConstantVariable.Format_ConstantVariables.LINE_END);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
    
    /************************************/
    
    static TogetherFilesHolderClass createTogetherGraphPropertyFile(String fileName)
    {    	
    	TogetherFilesHolderClass togetherFileHolder = new TogetherFilesHolderClass();
    	
    	String path= ConstantVariable.DefaultDirectoryNamesConstants.ROOT_DIRECTORY
		+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderRootDirectory.LATEST_RESULTS_DIRECTORY
		+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderLatestResultsDirectory.SYNTETIC_DATASETS_RESULTS_DIRECTORY
		+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderSynteticDatasetsResultsDirectory.SYNTETIC_DATASETS_GRAPHS_TOGETHER_DIRECTORY
		+ConstantVariable.DefaultDirectoryNamesConstants.DirectoriesUnderGenericGraphPropertyDirectory.MATLAB_CODE_FOLDER_NAME;
    	
    	togetherFileHolder.matlabFileName = fileName; 
    	   	
    	
    	fileName += ".m";

    	try {

    		File descFile=DirectoryStructureAndSettingsClass.createFile(path, fileName);
    		FileWriter fstream;
    		fstream = new FileWriter(descFile);
    		BufferedWriter out = new BufferedWriter(fstream);
    		togetherFileHolder.out = out;
    		return togetherFileHolder;
    	} catch (IOException e) {
    		// TODO Auto-generated catch block
    		e.printStackTrace();
    	}
    	return null;
    	
    }
    //TODO AS DEGIS.
    public static class TogetherFilesHolderClass
    {
    	public BufferedWriter out;
    	public String matlabFileName;
    }
    
    static void sytheticDataGenerationForTheDatasetsGeneratedWithTheSameParametersStartEvent(int numberOfSharedBits)
    {       	
    	outForMatlabCodeAverageDegreeVsSimilarityResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.AVERAGE_DEGREE_VS_CONTENT_SIMILARITY_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	
    	outForMatlabCodeLinearDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.LINEAR_DD_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeSemiLogYDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.SEMILOGY_DD_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeLogLogDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.LOGLOG_DD_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	
    	outForMatlabCodeCCVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.CC_VS_DD_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeHomophilyVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.HOMOPHILY_VS_DD_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);    	
    	outForMatlabCodeHomophilyVsDDDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.HOMOPHILY_VS_DD_DOT_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeLAVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.LOCAL_ALPHA_VS_DD_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeAccuracyVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.ACCURACY_VS_DD_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeAccuracyVsDDDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.ACCURACY_VS_DD_DOT_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	
    	outForMatlabCodeHomophilyVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile  = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.HOMOPHILY_VS_CC_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeHomophilyVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.HOMOPHILY_VS_CC_DOT_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeLAVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile  = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.LOCAL_ALPHA_VS_CC_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeLAVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.LOCAL_ALPHA_VS_CC_DOT_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeLAVsHomophilyResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.LOCAL_ALPHA_VS_HOMOPHILY_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeLAVsHomophilyDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.LOCAL_ALPHA_VS_HOMOPHILY_DOT_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeAccVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile  = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.ACCURACY_VS_CC_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	outForMatlabCodeAccVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.ACCURACY_VS_CC_DOT_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);
    	
	    outForMatlabCodeAccVsHomophilyResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.ACCURACY_VS_HOMOPHILY_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);;
	    outForMatlabCodeAccVsHomophilyDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.ACCURACY_VS_HOMOPHILY_DOT_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);;
	    
	    outForMatlabCodeAccVsLAResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.ACCURACY_VS_LOCAL_ALPHA_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);;
	    outForMatlabCodeAccVsLADotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile = createTogetherGraphPropertyFile(DefaultFileNamesConstants.GraphAllTogetherInOneForSynResultsFiles.ACCURACY_VS_LOCAL_ALPHA_DOT_GRAPH_ALL_IN_ONE_FILENAME_PREFIX+ConstantVariable.Format_ConstantVariables.DASH_CHAR+numberOfSharedBits);;

    }
    
    
    static void sytheticDataGenerationForTheDatasetsGeneratedWithTheSameParametersEndEvent(int numSharedElements)
    {
    	try {
    		
    		metaCorrelationsManagersList.prepareCorrelationsArrays();

    		LatexUtilityForSyntheticDatasetsResultsClass.synDataSummaryMetaResultsTableCreatorClass.addRecordToTheSynMetaResultsTableForTheSyntheticDatasetsGeneratedWithTheSameParameters();
    		LatexUtilityForSyntheticMetaCorrelationsResults.syntheticMetaCorrelationsTableCreatorClass.addRecordToTheSynMetaCorrelationsCOTableForTheSyntheticDatasetsGeneratedWithTheSameParameters(metaCorrelationsManagersList, numSharedElements);
    		LatexUtilityForSyntheticMetaCorrelationsResults.syntheticMetaCorrelationsTableCreatorClass.addRecordToTheSynMetaCorrelationsLOTableForTheSyntheticDatasetsGeneratedWithTheSameParameters(metaCorrelationsManagersList, numSharedElements);
    		LatexUtilityForSyntheticDatasetsResultsClass.increasesyntheticDatasetGeneratedWithTheSameParamatersIndex();
    		
    		outForMatlabCodeAverageDegreeVsSimilarityResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		
    		outForMatlabCodeLinearDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		outForMatlabCodeSemiLogYDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		outForMatlabCodeLogLogDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		
    		
    		outForMatlabCodeCCVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		outForMatlabCodeHomophilyVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		outForMatlabCodeHomophilyVsDDDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		outForMatlabCodeAccuracyVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		outForMatlabCodeAccuracyVsDDDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		outForMatlabCodeLAVsDDResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		
    		outForMatlabCodeHomophilyVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		outForMatlabCodeHomophilyVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    	    outForMatlabCodeLAVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    	    outForMatlabCodeLAVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    	    outForMatlabCodeLAVsHomophilyResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();  
    	    outForMatlabCodeLAVsHomophilyDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    	    outForMatlabCodeAccVsCCResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    	    outForMatlabCodeAccVsCCDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    	    outForMatlabCodeAccVsHomophilyResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    	    outForMatlabCodeAccVsHomophilyDotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    	    outForMatlabCodeAccVsLAResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();  
    	    outForMatlabCodeAccVsLADotResultsTogetherForSynDatasetsGeneratedWithTheSameParametersFile.out.close();
    		
    	} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	
    }
    
    /************************************/
    
    public static void createSyntheticDataset(GraphClass graph, GlobalClass global)
    {
    	
    	int numberOfInitialNodes = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.NUMBER_OF_INITIAL_NODES;
    	int numberOfFinalNodes = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.NUMBER_OF_FINAL_NODES;
    	
    	int numberOfLabels = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.NUMBER_OF_LABELS;
    	
    	int numberOfContentBits = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.NUMBER_OF_CONTENT_BITS;
    	int numberOfLinkBits = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.NUMBER_OF_LINK_BITS;    
        int numberOfSharedBits = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.NUMBER_OF_SHARED_BITS;
        
        int thresholdLevel = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.THRESHOLD;
        
        double reassignProb = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.REASSIGN_PROBABILITY;			//Not used for determinstic model.
        double biasedProbability =ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Constants.BIASED_PROBABILITY;
        
        System.out.println("uzunluk:"+ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Variables.SHARED_BITS_VALUES_FOR_THE_EXPERIMENTS.length);
        
        sytheticDataGenerationStartEvent();
        
        for(int numSharedElements = 0; numSharedElements < ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Variables.SHARED_BITS_VALUES_FOR_THE_EXPERIMENTS.length; numSharedElements++)
    	{	    	
        	numberOfSharedBits = ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Variables.SHARED_BITS_VALUES_FOR_THE_EXPERIMENTS[numSharedElements];
        	
        	metaResultsForTheDatasetsGeneratedWithTheSameParameters = new MetaResultListsClass();
        	metaCorrelationsManagersList = new MetaCorrelationsManagersListClass();
        	
        	sytheticDataGenerationForTheDatasetsGeneratedWithTheSameParametersStartEvent(numberOfSharedBits);

        	for(int dataSetNo = 0; dataSetNo < ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationParameter_Variables.MAX_NUMBER_OF_SYNTHETIC_DATASETS_TO_BE_GENERATED_WITH_THE_SAME_PARAMETERS; dataSetNo++)	
	    	{	
	    		syntheticDataGeneratorClass synDataGenerator= new syntheticDataGeneratorClass(dataSetNo,
	    				numberOfInitialNodes,				
	    				numberOfFinalNodes,
	    				numberOfLabels,
	    				
	    				numberOfContentBits,
	    				numberOfLinkBits,
	    				numberOfSharedBits,
	    				
	    				thresholdLevel,
	    				reassignProb,
	    				biasedProbability				
	    		);	    		
	    		
	    		String name = synDataGenerator.generateStyntheticDataset(ConstantVariable.SyntheticDataGeneration_Constants.SyntheticDataGenerationMethod_Constants.DETERMINISTIC_SINGLE_METHOD);
	    		DirectoryStructureAndSettingsClass.setDatasetName(name);
	    			    		
	    		String arffFilePath=ReadTest.Test(ConstantVariable.DataSet_Constants.SYNTETIC_DATASET, graph, global);
	    		
	    		ContentToLinkConverterClass ContentToLinkConverter = new ContentToLinkConverterClass(graph, ConstantVariable.Common_ConstantVariables.DEFAULT_CONTENT_TYPE, ConstantVariable.Common_ConstantVariables.DEFAULT_EDGE_TYPE_FOR_CONTENT_GRAPH, name);
	    		ContentToLinkConverter.createSimilarityMatrixInParallel();
	    		
	    		if(ConstantVariable.ExecutionParameters.calculateGraphPropertiesForLinkGraph==true)
	    		{
	    			statisticsManagerClass statisticsManagerForLink = new statisticsManagerClass(graph, global, ConstantVariable.Common_ConstantVariables.DEFAULT_EDGE_TYPE, name);		
	    			statisticsManagerForLink.execute();
	    		}
	    		
	    		if(ConstantVariable.ExecutionParameters.calculateGraphPropertiesForContentGraph==true)
	    		{
	    			statisticsManagerClass statisticsManagerForContent = new statisticsManagerClass(graph, global, ConstantVariable.Common_ConstantVariables.DEFAULT_EDGE_TYPE_FOR_CONTENT_GRAPH, name);		
	    			statisticsManagerForContent.execute();
	    		}
	    		
	    		statisticsManagerClass.tryToPrepareGraphPropsSummary(graph, global);
	    		
	    		
	    		if(ConstantVariable.ExecutionParameters.isContentOnlyExecutionEnabled)
	    		{
	    			synDataGenerator.resultsForCO = ContentOnlyClass.TestWithWekaInParallelStart(graph, global, ConstantVariable.CCA_ConstantVariables.NUMBER_OF_FOLDS_FOR_CONTENT_ONLY, null, ConstantVariable.ExecutionParameters.SELECTED_LOCAL_CLASSIFIER, ConstantVariable.ExecutionParameters.SELECTED_SECOND_LEVEL_LOCAL_CLASSIFIER);	    			
	    			metaResultsForTheDatasetsGeneratedWithTheSameParameters.getResultsListForCOOfTheDatasetsGeneratedWithTheSameParameters().add((ResultClassListClass)synDataGenerator.resultsForCO.clone());
	    		}
	    		
	    		if(ConstantVariable.ExecutionParameters.isLinkOnlyExecutionEnabled)
	    		{
	    			synDataGenerator.resultsForLO = LinkOnlyClass.TestWithWekaInParallelStart(graph, global, ConstantVariable.CCA_ConstantVariables.NUMBER_OF_FOLDS_FOR_LINK_ONLY, null, ConstantVariable.ExecutionParameters.SELECTED_LOCAL_CLASSIFIER, ConstantVariable.ExecutionParameters.SELECTED_SECOND_LEVEL_LOCAL_CLASSIFIER);
	    			metaResultsForTheDatasetsGeneratedWithTheSameParameters.getResultsListForLOOfTheDatasetsGeneratedWithTheSameParameters().add((ResultClassListClass)synDataGenerator.resultsForLO.clone());
	    		}
	    		
	    		if(ConstantVariable.ExecutionParameters.isICAExecutionEnabled)
	    		{
	    			synDataGenerator.resultsForICA = ICAClass.TestWithWekaInParallelStart(graph, global, ConstantVariable.CCA_ConstantVariables.NUMBER_OF_FOLDS_FOR_ICA, null, ConstantVariable.ExecutionParameters.SELECTED_LOCAL_CLASSIFIER, ConstantVariable.ExecutionParameters.SELECTED_SECOND_LEVEL_LOCAL_CLASSIFIER);
	    			metaResultsForTheDatasetsGeneratedWithTheSameParameters.getResultsListForICAOfTheDatasetsGeneratedWithTheSameParameters().add((ResultClassListClass)synDataGenerator.resultsForICA.clone());
	    		}
	    		
	    		if(ConstantVariable.ExecutionParameters.isMetaClassifierExecutionEnabled)
	    		{
	    			ArrayList<ResultClassListClass> resultsOfMetaAlgorihms = new ArrayList<ResultClassListClass>();
	    			
	    			synDataGenerator.resultsForAVE = new ResultClassListClass();
	    			synDataGenerator.resultsForMAX = new ResultClassListClass();
	    			synDataGenerator.resultsForPROD = new ResultClassListClass();
	    			synDataGenerator.resultsForLA = new ResultClassListClass();
	    			synDataGenerator.resultsForDFMM = new ResultClassListClass();
	    			synDataGenerator.resultsForLB = new ResultClassListClass();
	    			synDataGenerator.resultsForLAMAX = new ResultClassListClass();
	    			synDataGenerator.resultsForLBMAX = new ResultClassListClass();
	    			
	    			if(ConstantVariable.ExecutionParameters.isMetaClassifierExecutionEnabled)
	    			{
	    				if(ConstantVariable.MetaClassifierExecutionParameters.isMetaClassifierAverageMethodEnabled)	    			
		    				synDataGenerator.resultsForAVE = (ResultClassListClass)synDataGenerator.resultsForAVE.clone();
	    				
	    				if(ConstantVariable.MetaClassifierExecutionParameters.isMetaClassifierMaxMethodEnabled)
	    					synDataGenerator.resultsForMAX = (ResultClassListClass)synDataGenerator.resultsForMAX.clone();
		    			
	    				if(ConstantVariable.MetaClassifierExecutionParameters.isMetaClassifierProductMethodEnabled)
	    					synDataGenerator.resultsForPROD = (ResultClassListClass)synDataGenerator.resultsForPROD.clone();
		    			
	    				if(ConstantVariable.MetaClassifierExecutionParameters.isMetaClassifierLocalAlphaMethodEnabled)
	    					synDataGenerator.resultsForLA = (ResultClassListClass)synDataGenerator.resultsForLA.clone();
		    			
	    				if(ConstantVariable.MetaClassifierExecutionParameters.isMetaClassifierDegreeFilterMethodEnabled)
	    					synDataGenerator.resultsForDFMM = (ResultClassListClass)synDataGenerator.resultsForDFMM.clone();
		    			
	    				if(ConstantVariable.MetaClassifierExecutionParameters.isMetaClassifierLocalBetaMethodEnabled)
	    					synDataGenerator.resultsForLB = (ResultClassListClass)synDataGenerator.resultsForLB.clone();
		    			
	    				if(ConstantVariable.MetaClassifierExecutionParameters.isMetaClassifierLocalAlphaMaxMethodEnabled)
	    					synDataGenerator.resultsForLAMAX = (ResultClassListClass)synDataGenerator.resultsForLAMAX.clone();
		    			
	    				if(ConstantVariable.MetaClassifierExecutionParameters.isMetaClassifierMaxMethodEnabled)
	    					synDataGenerator.resultsForLBMAX = (ResultClassListClass)synDataGenerator.resultsForLBMAX.clone();
	    				
	    				
	    			}
	    			

	    			resultsOfMetaAlgorihms.add(synDataGenerator.resultsForAVE);
	    			resultsOfMetaAlgorihms.add(synDataGenerator.resultsForMAX);
	    			resultsOfMetaAlgorihms.add(synDataGenerator.resultsForPROD);
	    			resultsOfMetaAlgorihms.add(synDataGenerator.resultsForLA);
	    			resultsOfMetaAlgorihms.add(synDataGenerator.resultsForDFMM);
	    			resultsOfMetaAlgorihms.add(synDataGenerator.resultsForLB);
	    			resultsOfMetaAlgorihms.add(synDataGenerator.resultsForLAMAX);
	    			resultsOfMetaAlgorihms.add(synDataGenerator.resultsForLBMAX);

	    			MetaClassifierManagerClass.TestInParallelStart(graph, global, ConstantVariable.CCA_ConstantVariables.NUMBER_OF_FOLDS_FOR_META_CLASSIFIER, null, resultsOfMetaAlgorihms);
	    		}
	    		
	    		//ContentOnlyClass.Test(graph, global);
	    		//LinkOnly_Class.Test(graph, global);
	    		
	    		ArrayList<ResultClassListClass> results=new ArrayList<ResultClassListClass>();
	    		results.add(synDataGenerator.resultsForCO);
	    		results.add(synDataGenerator.resultsForLO);
	    		results.add(synDataGenerator.resultsForICA);  		
	    		
	    		results.add(synDataGenerator.resultsForAVE);
	    		results.add(synDataGenerator.resultsForMAX);
	    		results.add(synDataGenerator.resultsForPROD);
	    		results.add(synDataGenerator.resultsForLA);
	    		results.add(synDataGenerator.resultsForDFMM);
	    		results.add(synDataGenerator.resultsForLB);
	    		results.add(synDataGenerator.resultsForLAMAX);
	    		results.add(synDataGenerator.resultsForLBMAX);
	    		
	    	    		
	    		evaluationOfOneSyntheticDataSetIsCompletedEvent(synDataGenerator, graph, name, results);
	    		
	       		//System.out.println("Using graph");
	    		//Evaluation resultsForOnTheFly = WekaAdaptorClass.testWithTheGivenInstances(WekaAdaptorClass.generateDatasetOnTheFly(graph));
	    		
	    		//System.out.println("Using file");
	    		//Evaluation resultsForTheFile = WekaAdaptorClass.testWithTheGivenInstances(WekaAdaptorClass.getInstancesFromFile(arffFilePath));
	    		
	    		//LatexUtilityClass.synDataResultsTableCreatorClass.addRecordToTheSynResultsTableForTheNewSyntheticDataset(outForSyntehicDataResultsFile, resultsForOnTheFly, resultsForTheFile);
	    		
	    		//ContentOnlyClass.TestInParallel(graph, global);
	    		//statisticsManagerClass statisticsManager = new statisticsManagerClass(graph, ConstantVariable.Common_ConstantVariables.DEFAULT_EDGE_TYPE, name);		
	    		//statisticsManager.execute();
	    		//System.out.println("Avg Path Length"+graph.getPropertiesOfTheGraphWithRespectToEdgeType().get(ConstantVariable.Common_ConstantVariables.DEFAULT_EDGE_TYPE).shortestPathRelatedProps.getAveragePathLength());
	    		graph.ClearAllGraph();
	    		global.linksChecker.clearAllLinksCheckerStatistics();
	    		//LinkOnly_Class.TestInParallel(graph, global);
				
	    	}
        	sytheticDataGenerationForTheDatasetsGeneratedWithTheSameParametersEndEvent(numberOfSharedBits);        	
    	}        
        sytheticDataGenerationEndEvent();
    }
}




